<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
// +----------------------------------------------------------------------

namespace Admin\Controller;
use User\Api\UserApi;

/**
 * 后台用户控制器
 * @author 麦当苗儿 <zuojiazi@vip.qq.com>
 */

class ReportController extends AdminController {

//    static protected $allow = array( 'updatePassword','updateNickname','submitPassword','submitNickname');

    /**
     * 考勤日志首页
     * @author 麦当苗儿 <zuojiazi@vip.qq.com>
     */
    public function index(){
    	$nickname = I('nickname');
    	$map = array('status'=>array('egt',0));
    	if(isset($nickname)){
    		if(intval($nickname) !== 0){
    			$map['uid'] = intval($nickname);
    		}else{
    			$map['name']  = array('like', '%'.(string)$nickname.'%');
    		}
    	}
        $time_start = I('time-start',0,'strtotime');
        $time_end = I('time-end',0,'strtotime');
        if($time_start>0){
            $map['create_time'][] = array('gt',$time_start);
        }
        if($time_end>0){
            $map['create_time'][] = array('lt',$time_end);
        }
        $list   = $this->lists('report', $map);
        $this->assign('_list', $list);
        $this->meta_title = '日报记录';
        $this->display();
    }

    public function detail(){
        $id = I('id',0,'intval');
        $obj = M('report');
        $info = $obj->where('id='.$id)->find();
        $this->assign('info',$info);
        $this->display();
    }



}
